﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Xpom_Xpum__Browser_Integrator
{
    static class Facade
    {
        static Subsystems.CrxManager CrxManagerObject = new Subsystems.CrxManager();
        static Subsystems.LoadManager LoadManagerObject = new Subsystems.LoadManager();
        static Subsystems.ZipManager ZipManagerObject = new Subsystems.ZipManager();

        public static void ProcessPackCRX(string[] args)
        {
            if (args.Length >= 3)
            {
                if (args.Length >= 4)
                {
                    CrxManagerObject.PackDirectoryToCRXWithPEM(args[1], args[2], args[3]);
                }
                else
                {
                    CrxManagerObject.PackDirectoryToCRX(args[1], args[2]);
                }
            }
            else
            {
                Console.WriteLine("Error - At least 3 arguments required.");
                Console.ReadKey();
            }
        }

        public static void ProcessPackZIP(string[] args)
        {
            if (args.Length >= 2)
            {
                if (args.Length >= 3)
                {
                    ZipManagerObject.PackDirectoryToZIP(args[1], args[2]);
                }
                else
                {
                    ZipManagerObject.PackDirectoryToZIP(args[1]);
                }
            }
            else
            {
                Console.WriteLine("Error - At least 1 argument required.");
                Console.ReadKey();
            }
        }

        public static void ProcessRun(string[] args)
        {
            if (args.Length >= 3)
            {
                LoadManagerObject.LoadExtensionFromDirectory(args[1], args[2]);
            }
            else
            {
                Console.WriteLine("Error - At least 3 arguments required");
                Console.ReadKey();
            }
        }

        public static void Error() { }
    }
}